package com.wyvoid.forum.service.impl;

import com.wyvoid.forum.service.IMessageService;
import com.wyvoid.forum.domain.Message;
import com.wyvoid.forum.dao.IMessageDAO;
import com.wyvoid.core.persistent.hibernate.HibernatePage;
import com.wyvoid.core.persistent.Pagination;

import java.util.List;

import org.springframework.transaction.annotation.Transactional;

/**
 * Created by IntelliJ IDEA.
 * User: new
 * Date: 2007-5-21
 * Time: 15:21:34
 * To change this template use File | Settings | File Templates.
 */
@Transactional
public class MessageService implements IMessageService {
    private IMessageDAO messageDAO;

    public void setMessageDAO(IMessageDAO messageDAO) {
        this.messageDAO = messageDAO;
    }

    public void createMessage(Message message) {
        messageDAO.create(message);
    }

    public void editMessageStatus(int msgId, int status) {
//To change body of implemented methods use File | Settings | File Templates.
    }

    public void deleteMessage(int messageId, String operator) {
//To change body of implemented methods use File | Settings | File Templates.
    }

    public void deleteMessage(long messageId) {
        Message message=this.getMessage(messageId);
        messageDAO.delete(message);
    }

    public void deleteMoreMessage(Integer[] ids) {
//To change body of implemented methods use File | Settings | File Templates.
    }

    public void deleteMoreMessage(Integer[] ids, String operator) {
//To change body of implemented methods use File | Settings | File Templates.
    }

    public void deleteSendMessage(String sender) {
//To change body of implemented methods use File | Settings | File Templates.
    }

    public void cleanTrash(String username) {
//To change body of implemented methods use File | Settings | File Templates.
    }

    public void trashMessage(int messageId, String operator) {
//To change body of implemented methods use File | Settings | File Templates.
    }

    public void trashMoreMessage(Integer[] ids, String operator) {
//To change body of implemented methods use File | Settings | File Templates.
    }

    public void trashSendMessage(String sender) {
//To change body of implemented methods use File | Settings | File Templates.
    }

    public void editMessage(Message message) {
        messageDAO.update(message);
    }

    public Message getMessage(long messageId) {
      return messageDAO.getById(messageId);
    }

    public Message viewMessage(int messageId) {
        return null;  //To change body of implemented methods use File | Settings | File Templates.
    }

    public HibernatePage getMySendMessages(long sendUserId, Pagination pagination) {
         return messageDAO.getMySendMessages(sendUserId,pagination);
    }

    public List getMessages(String receiver, int dataNum) {
        return null;  //To change body of implemented methods use File | Settings | File Templates.
    }

    public HibernatePage getMyMessages(long receiverId, Pagination pagination) {
        return messageDAO.getMyMessages(receiverId,pagination);
    }

    public HibernatePage getMessagesByStatus(int status, long receiverId, Pagination pagination) {
            return null;  //To change body of implemented methods use File | Settings | File Templates.
    }

    public HibernatePage getTrashMessages(long userId, Pagination pagination) {
         return messageDAO.getTrashMessages(userId,pagination);
    }

    public HibernatePage getDraftMessages(int status, long sendUserId, Pagination pagination) {
         return messageDAO.getDraftMessages(status,sendUserId,pagination);
    }

    public HibernatePage getMessagesByFlag(int flag, Pagination pagination) {
        return null;  //To change body of implemented methods use File | Settings | File Templates.
    }

}
